﻿--[[
Much credit to Tristan, the author of the very old TinyPadFu, and Tristanian, the author of Broker_Factions, which I looked to for help with this addon.
]]--
local BTP = CreateFrame("Frame", "Broker_TinyPad")

BTP.obj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Broker_TinyPad", {
	type = "launcher",
	label = "Broker_TinyPad",
	icon = "Interface\\Icons\\INV_Misc_Note_01",
	})

function BTP.obj:OnClick()
	TinyPad:Toggle()
end

function BTP.obj.OnTooltipShow(tt)
	tt:AddLine("Broker_TinyPad",1,1,1)
	tt:AddLine("Click to toggle the TinyPad frame.")
	tt:AddLine(" ")
	tt:AddLine("Index of Pages:")
	
	for i=1, #TinyPadPages do
		local pageName = PageName(TinyPadPages[i])
		tt:AddDoubleLine("Page "..i..":", pageName)
	end
	tt:Show()
end

function PageName(page)
	local page = strsplit("\n", page)
	return strsub(page,1,25)
end
